//
//  ArticoloViewController.m
//  Microtalk
//
//  Created by Dario Trisciuoglio on 28/02/12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "ArticoloViewController.h"
#import "AutoDownloadImageView.h"
@implementation ArticoloViewController

@synthesize indirizzo,titolo,descrizione,imageUrl,titoloArticolo,descrizioneArticolo,scrollArticolo,imageArticoloView;

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = titolo;
    self.titoloArticolo.text = titolo;
    self.descrizioneArticolo.text = descrizione;
    scrollArticolo = [UIScrollView alloc];
    scrollArticolo = [scrollArticolo init];
    
    [scrollArticolo setFrame:CGRectMake(0,0,320,480)];
    [scrollArticolo setContentSize:CGSizeMake(320,480 * 4)];
    
	AutoDownloadImageView *img = [[AutoDownloadImageView alloc]
								  initWithFrame:CGRectMake(0, 0, 100, 160)
								  URL:imageUrl
								  persistency:YES
								  forceDownload:NO
								  ];
	//[img setDelegate:self];
	[self.imageArticoloView addSubview:img];
}

-(void)autoDownload:(AutoDownloadImageView *)autoDowload didFailWithError:(NSError *)error {
	NSLog(@"SOMETHING WRONG");
}

-(void)autoDownloadImageViewFinishDownloading:(AutoDownloadImageView *)autoDowload {
	NSLog(@"OK");
}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    self.titolo = nil;
    self.indirizzo = nil;
    self.imageUrl = nil;
    self.titoloArticolo = nil;
    self.descrizioneArticolo = nil;
}


- (void)dealloc {
    [titolo release];
    [indirizzo release];
    [imageUrl release];
    [titoloArticolo release];
    [descrizioneArticolo release];
    [super dealloc];
}


@end
